#version 300 es

layout(location = 0) in vec2 point; // zw is not used
uniform vec4 viewRect; // x = left, y = right, z = bottom, w = top

void main() {
    float x = -1.0 + (point.x - viewRect.x) / (viewRect.y - viewRect.x) * 2.0;
//    x = clamp(x, -1.0, 1.0);
    float y = -1.0 + (point.y - viewRect.z) / (viewRect.w - viewRect.z) * 2.0;
//    y = clamp(y, -1.0, 1.0);
    gl_Position = vec4(x, y, 0, 1);
    gl_PointSize = 6.0;

//    gl_Position = vec4(-1 + 0.1 * gl_VertexID, -1 + 0.1 * gl_VertexID, 0, 1);
}
